The Elder Scrolls Forums

TES Construction Set and Plugins >> General TES Construction Set

Pages: 1
shannon_
Curate

Reged: 06/05/04
Posts: 756
Please help me with my script...
      #2971298 - 08/26/04 01:39 AM

I've made a script that allows the player to replace a carpet tile with another of the same color. You must be wearing a special ring, otherwise the carpet tiles switch to unnamed versions, which cannot be interacted with. Put the ring back on, and the tiles switch to the named versions.

Now, heres what I have so far:

-------------------

This is the 'named' script:

Begin Ishan_carpetscriptB

short button
short questionState
short doonce
float timer

if ( jjsFurnSwitch == 2 ) ;this is the variable that says you are wearing the ring;
disable
PlaceAtMe Ishan_Mfloor2UN 1 0 0 ;heres where the named object is replaced with the unnamed one;
set doonce to 1
endif

if ( OnActivate == 1 )
Set questionState to 1
Return
endif

if ( questionState == 0 )
Return
endif

if ( questionState == 1 )
MessageBox, "Do you wish to change carpet color now?", "Red", "Blue", "Green"
Set questionState to 2
endif

if ( questionState == 2 )
set button to GetButtonPressed

if ( button == 0 )
MessageBox "Okay."
PlaySound Thunder1
PlaceAtMe Ishan_Mfloor1 1 0 0
set doonce to 0
Set questionState to 0
endif

if ( button == 1 )
MessageBox "Okay."
PlaySound Thunder1
PlaceAtMe Ishan_Mfloor2 1 0 0
set doonce to 0
Set questionState to 0
endif

if ( button == 2 )
MessageBox "Okay."
PlaySound Thunder1
PlaceAtMe Ishan_Mfloor3 1 0 0
set doonce to 0
Set questionState to 0
endif

endif

; waits a few seconds, then completely deletes the figurine to clean the game
if ( GetDisabled == 1 )
Set timer to ( timer + GetSecondsPassed )
if ( timer > 10 )
SetDelete 1
endif
return
endif

End

---------------------

Okay, now heres the 'unnamed' script, which only serves to keep the word 'carpet' from showing up wherever you go. Thats only when you are NOT wearing the ring:

Begin Ishan_carpetscriptBUN

short button
short questionState
short doonce
float timer

if ( jjsFurnSwitch == 2 )
if ( doonce == 0 )
disable
PlaceAtMe Ishan_Mfloor2 1 0 0 ;and this is where the unamed object is replaced by the named;
set doonce to 1
endif
endif

if ( getDisabled == 1 )
set timer to ( Timer + GetSecondsPassed )
if ( timer > 10 )
setdelete, 1
endif
endif

End

--------------------------

The carpet tiles switch color just like I want them to, but when I remove the ring, the game crashes. I know this is a pretty complicated script, but I think I know whats wrong. Somewhere along the line, something I am telling the game to do is happening over and over and over. I need to make that thing only happen once. At least thats how it seems to me.

I really hope someone can help me, because I have no clue what to do next.

Post Extras: Print Post   Remind Me!   Notify Moderator  
shannon_
Curate

Reged: 06/05/04
Posts: 756
Re: Please help me with my script... [Re: shannon_]
      #2971320 - 08/26/04 01:46 AM

Wait a minute...I think I might just see the problem. The ring variable! It's set to the same number in both scripts, thats not right! I'll be back.

Post Extras: Print Post   Remind Me!   Notify Moderator  
shannon_
Curate

Reged: 06/05/04
Posts: 756
Re: Please help me with my script... [Re: shannon_]
      #2971385 - 08/26/04 02:13 AM

Darn, it's not working!! Someone, help!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: Please help me with my script... [Re: shannon_]
      #2971616 - 08/26/04 05:16 AM

Should the carpet be placed manually in game or it has a pre-defined position? If latter, do not bother with PlaceAtMe and SetDelete whatsoever. Place all four carpets at the same point in CS, then enable one of them and disable others depending on ring state.

Code:
begin CarpetRing
short worn
short OnPCEquip
short button

if ( OnPCEquip == 1 )
if ( worn == 0 )
set worn to 1
endif
else
if ( worn > 1 )
set worn to 0
CarpetRed->Disable
CarpetBlue->Disable
CarpetGreen->Disable
CarpetUnnamed->Enable
endif
endif

if ( worn == 0 )
return
elseif ( worn == 1 )
MessageBox, "Do you wish to change carpet color now?", "Red", "Blue", "Green"
set worn to 2
CarpetRed->Disable
CarpetBlue->Disable
CarpetGreen->Disable
CarpetUnnamed->Disable
elseif ( worn == 2 )
set button to GetButtonPressed

if ( button == 0 )
MessageBox "Okay."
PlaySound Thunder1
CarpetRed->Enable
set worn to 3
endif

if ( button == 1 )
MessageBox "Okay."
PlaySound Thunder1
CarpetBlue->Enable
set worn to 3
endif

if ( button == 2 )
MessageBox "Okay."
PlaySound Thunder1
CarpetGreen->Enable
set worn to 3
endif

endif

end


Place "unnamed" carpet a single pixel higher than others (you may have to temporarily swicth off "Snap to Grid" setting for that) so that default carpet would override all others without additional scripting.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: Please help me with my script... [Re: shannon_]
      #2972212 - 08/26/04 11:10 AM



if ( jjsFurnSwitch == 2 ) ;this is the variable that says you are wearing the ring;
disable
PlaceAtMe Ishan_Mfloor2UN 1 0 0 ;heres where the named object is replaced with the unnamed one;
set doonce to 1
endif



if ( jjsFurnSwitch == 2 )
if ( doonce == 0 )
disable
PlaceAtMe Ishan_Mfloor2 1 0 0 ;and this is where the unamed object is replaced by the named;
set doonce to 1
endif
endif



Notice the difference between your two scripts? I assume that if jjsFurnSwitch is 2, then the ring is not on your finger. Well the top loop is always run even when doOnce is set to 1.

BTW, you do realize that this tile concept would make for a very interesting puzzle trap/lock, right?

And the guy's suggestion to simply enable/disable four pieces of tile set in the same place is a much more elegant way of doing the job, if that is what you had in mind. And since I did not see any Activate commands, it would appear that you can't actually pick up the tile and move it. The only down side to this that I have found so far (I am doing a simpler idea with replacing inventory items) is that you now have four tiles with scripts all running to see if the ring is on your finger. Now multiply that by the number of tiles you have in the carpet and you will see a significant drop in fps. Your setdelete command eliminates 75% of the running scripts in the carpet. I used while-end loops to replace the inventory items and even fifty replacements caused a noticable slowdown. If I tried to replace more than 100 items, the program tended to crash. But that was with while-end loops...


Post Extras: Print Post   Remind Me!   Notify Moderator  
shannon_
Curate

Reged: 06/05/04
Posts: 756
Re: Please help me with my script... [Re: ]
      #2973258 - 08/26/04 07:17 PM

militech, I saw that ring variable problem, fixed it and still had crashes.

Heres a couple pics to illustrate what I'm talking about, I don't know if I explained it very well.

I only have to place one layer in the CS

the player then changes each tile individualy

this is with the ring on, the carpets are named, so you can interact with them

ring off, no-name carpets, placed in same place, cant interact with these

I based most of the scripts from the 'real funiture' mod, and they work fine. But for this one, I made a few alterations, because you can't pick the carpet up or rotate it, but it slows down on me when I unequip the ring, and freezes entirely when I put it back on.

I can't understand why it works so well for the furniture, and not for the carpets!

Kir's idea sounds pretty good, but wont having a room full of that many scripted objects slow things down? Thats why I want to replace, disable, then delete. (because disable does not get rid of things completely, or so I've heard) Besides, it's easier to place one layer of tiles than four...

Post Extras: Print Post   Remind Me!   Notify Moderator  
Simpleton
Acolyte

Reged: 07/02/04
Posts: 138
Loc: Earlham College, Richmond, IN
Re: Please help me with my script... [Re: shannon_]
      #2973407 - 08/26/04 08:04 PM

It's hard to say without being able to actually see what's going on. If you'd like I'd be willing to debug it for you. If you do I'll pm you a link to upload the esp to.

--------------------
Do you have a burning desire to give me money?
Click Here to Donate

Post Extras: Print Post   Remind Me!   Notify Moderator  
shannon_
Curate

Reged: 06/05/04
Posts: 756
Re: Please help me with my script... [Re: Simpleton]
      #2973422 - 08/26/04 08:11 PM

Id love to do that, but someone has screwed with my browser settings, and I probably would be denied access to most sites...unfortunaley that someone is not home at the moment so that I can wring their neck.

As soon as get this password thing removed, I'd be happy to accept your help.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: Please help me with my script... [Re: shannon_]
      #2973534 - 08/26/04 08:46 PM

militech, I saw that ring variable problem, fixed it and still had crashes.



I always wondered why people never could get the point I am trying to make. Perhaps I should try communicating explicitly instead of implicitly.

I was trying to get you to look at the fact that you are missing a loop to deal with the fact that DoOnce is no longer zero in the first sample, but you remembered to take care of it in the second. Your intuition about what was causing the crash was dead on target. And yes, I also spend days sometimes staring at my own code without realizing that I had forgotten an if condition. It's because we tend to see what is not there when it's our own code. Just add an

if ( doOnce == 0 )

disable
PlaceAtMe Ishan_Mfloor2UN 1 0 0 ;heres where the named object is replaced with the unnamed one;
set doonce to 1

endif ; doOnce loop






Heres a couple pics to illustrate what I'm talking about, I don't know if I explained it very well.


I based most of the scripts from the 'real funiture' mod, and they work fine. But for this one, I made a few alterations, because you can't pick the carpet up or rotate it, but it slows down on me when I unequip the ring, and freezes entirely when I put it back on.





It was pretty clear to me what you were trying to do (remember, I have already done something in the same vein). Now the slowdown is due to every single tile running the following:

Begin Ishan_carpetscriptBUN

short button
short questionState
short doonce
float timer

if ( jjsFurnSwitch == 2 )
if ( doonce == 0 )
disable
PlaceAtMe Ishan_Mfloor2 1 0 0 ;and this is where the unamed object is replaced by the named;
set doonce to 1
endif
endif
.
.
.
etc.


p.s. note that you have the variables questionState and button declared here but not used.




I can't understand why it works so well for the furniture, and not for the carpets!



I'm willing to bet that there are fewer pieces of furniture with scripts running than you have tiles on the floor.








Kir's idea sounds pretty good, but wont having a room full of that many scripted objects slow things down? Thats why I want to replace, disable, then delete. (because disable does not get rid of things completely, or so I've heard) Besides, it's easier to place one layer of tiles than four...




If you are already seeing a degradation of cpu speed with just one layer, you should probably multiply that slowdown by four if you have four layers. Your way is the least cpu intensive. And yes, if you do not delete the object, the script attached to it will still run while the object is disabled ( = just not rendered/visible to the player).

As for layering four tiles in the same place, just copy the x, y, z co-ords of the first tile into the locations of the other two (unnamed tile is one pixel higher on the z-axis).

Good luck.

Post Extras: Print Post   Remind Me!   Notify Moderator  
ManaUser
Master

Reged: 05/31/00
Posts: 6115
Loc: Long Beach, CA, USA
Re: Please help me with my script... [Re: shannon_]
      #2973548 - 08/26/04 08:49 PM

It's a little hard to follow, but I'd say there's a very good chance the crash is due to using SetDelete in the same frame as another funtion on that object. Try replacing your current SetDelete section with this this at the top of the script (right after variable declaration).

Code:
if ( GetDisabled == 1 ) 
SetDelete 1
return
endif



The timer method, while thought to be good at one time, only complicates things.

Post Extras: Print Post   Remind Me!   Notify Moderator  
shannon_
Curate

Reged: 06/05/04
Posts: 756
Re: Please help me with my script... [Re: ]
      #2974029 - 08/26/04 11:15 PM

Thank you militech! It's working!!!!!!!!!!!!!!!!!!

I could just kiss you. I knew it had to be some little detail I overlooked, because the script tried to work. Now it works perfectly, not a hint of slowdown at all.

This will be a very handy script to have, all you have to do is script a few meshes, and place one of them on the floor, for customizable housing. I bet that it could be used to switch tileset parts too. Imagine, build a imperial interior, and make them switch to stronghold parts. Or if you had multiple retextures of a certain tileset, you could build a transformable house.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: Please help me with my script... [Re: shannon_]
      #2974176 - 08/26/04 11:58 PM

This will be a very handy script to have, all you have to do is script a few meshes, and place one of them on the floor, for customizable housing. I bet that it could be used to switch tileset parts too. Imagine, build a imperial interior, and make them switch to stronghold parts. Or if you had multiple retextures of a certain tileset, you could build a transformable house.


Personally, I still think that it would make a better trap or puzzle, but hey, I'm an engineer, not an interior decorator...

Although, a Go-Go Gadget House would be quite the thing to see. With a simple wearing of the right ring, you can watch your castle disguise itself as a fishing shack (one big fishing shack, but still a fishing shack). You have got to look into transformable exteriors! You could give a literal meaning to the saying 'A man's home is his castle' and start a whole new wave of housing construction.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Archived User Account

Re: Please help me with my script... [Re: shannon_]
      #2979963 - 08/28/04 04:56 PM

Hey, your idea got me thinking about something on a tangential line:

What if a modder added a virtually unkillable monster as guardian for a lair (e.g. an uber rat). The powergamers would probably just give up trying to get into the lair after a few tries, but for the players that like to think and follow leads, there could be a legendary weapon (e.g. normal dagger with a script attached) that could be sought out to slay the beast. If the guardian detects the weapon equipped in the pc's hands, a script like yours would substitute the uber creature for a normal one. If they foolishly switch to their uber weapon...

Interesting possibilities...


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1


Extra information
1 registered and 2 anonymous users are browsing this forum.

Moderator:  Umrahel, Freddo, Pete, Hungry Donner, Attrebus, Miltiades, tegger 

Print Thread

Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 153

Rate this thread
 
Jump to

The Elder Scrolls Homepage

*
UBB.threads™ 6.3

Click for Privacy Statement © 2003 Bethesda Softworks LLC, a ZeniMax Media company. All Rights Reserved.
PRIVACY POLICY | TERMS & CONDITIONS | LEGAL INFORMATION | CONTACT US